package com.ymatou.iapi.coupon.service;

import com.ymatou.iapi.coupon.parameter.SellerCouponsList;
import com.ymatou.iapi.coupon.parameter.availableCoupon;
import com.ymatou.iapi.coupon.parameter.bestCoupon;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
/**
*商详最优的买手券和平台券Call
*FreeMaker Template自动生成代码
*/
public class GetProductBestCouponCall extends YmatouBaseCall{
	private static String opurl ="api/Promotion/getProductBestCoupon";
	
	public GetProductBestCouponCall() {
		super(EnvSetup.getSystemUrl("couponiapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	
    public String getStatusCode1()
    {
        return getString("statusCode");
    }

    public String getMessage()
    {
        return getString("message");
    }

    public String getData()
    {
        return getString("data");
    }

    public bestCoupon getBestCouponList()
    {
    	bestCoupon data = null;
        try {
            data =(bestCoupon) FormatUtil.GSONToObject(DataUtil.Json.parseJsonObj(getData()).toString(), bestCoupon.class);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    
    
    public availableCoupon getAvailableCouponList()
    {
    	availableCoupon data = null;
        try {
            data =
                    (availableCoupon) FormatUtil.GSONToObject(
                    		DataUtil.Json.parseJsonObj(getData()).toString(), availableCoupon.class);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}